package org.example.sec12;

import com.seaway.models.sec12.AccountBalance;
import com.seaway.models.sec12.BalanceCheckRequest;
import com.seaway.models.sec12.BankServiceGrpc;
import io.grpc.ManagedChannelBuilder;
import io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder;
import org.junit.jupiter.api.Test;

public class GrpcSsl extends AbstractTest{
    @Test
    public void demo(){
        var channel= NettyChannelBuilder.forAddress("localhost",5555)
                .sslContext(clientSslContext()).build();
       var  stub= BankServiceGrpc.newBlockingStub(channel);
       var request= BalanceCheckRequest.newBuilder()
                .setAccountNumber(1).build();
        var  rsp = stub.getAccountBalance(request);
        System.out.println(rsp);

    }


}
